package 反射6;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;


import org.springframework.jdbc.core.JdbcTemplate;




import static sun.security.krb5.Confounder.intValue;

/**
 * @Auther:lele
 * @Date:2025/3/14
 */
public class Test {
    public static void main(String[] args) throws Exception {
//         MyhandleDbReflection.insert("insert into user value(?,?,?)", "张三", "1234", 500);
        user s = MyhandleDbReflection.queryBean("select * from user where admin=?", user.class,"张三");
        System.out.println("s = " + s);
//        user bean1 = MyhandleDbReflection.queryBean1("select * from user where admin=?", user.class, "张三");
//        HashMap<String, Object> stringObjectHashMap = MyhandleDbReflection.mapQuery("select * from user where id=?", 13);
//        System.out.println("stringObjectHashMap = " + stringObjectHashMap);
//        List<Object> objects = MyhandleDbReflection.mapQueryList("select * from user where admin=?", "张三");
//        System.out.println("objects = " + objects);
//        List<Object[]> objects = MyhandleDbReflection.quaryLists("select * from user where admin=?", "张三");
//        for (int i = 0; i < objects.size(); i++) {
//            System.out.println("Arrays.toString(arrayList.get(i)) = " + Arrays.toString(objects.get(i)));
//        }
        //1、导入5个Jar包
        //2、新建对象
//        JdbcTemplate jdbc = new JdbcTemplate(反射6.JDBCUtil2.getDatasource());
//        //3、编写sql语句
//        String  sql = "update user set password = 123 where id=?";
//        //4、执行修改语句
//        int count = jdbc.update(sql, "13");
//        //5、打印输出
//        System.out.println(count);


    }
}
